//
//  CandLTableViewCell.m
//  SafeFoodManagerDemo
//
//  Created by bob on 2017/10/17.
//  Copyright © 2017年 bob. All rights reserved.
//

#import "CandLTableViewCell.h"

@implementation CandLTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(void)setIsClick:(BOOL)isClick
{
    _isClick=isClick;
    
    if (self.isClick) {
        self.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    }else{
        self.accessoryType=UITableViewCellAccessoryNone;
    }
    
}

-(void)setDeleStatue:(BOOL)deleStatue
{
    _deleStatue=deleStatue;
    
    if (deleStatue) {
        
        self.editImageView.hidden=NO;
        
        self.accessoryType=UITableViewCellAccessoryNone;
        
    }else{
        
        self.editImageView.hidden=YES;
        self.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        
    }
    
}

-(void)setModel:(CandLData *)model
{
    _model=model;
    
    self.OrderIDLabel.text=model.orderSn;
    
    if (self.isClick) {

        self.Namelabel.text=model.supplierName;

    }else{

        if (model.supplierName==nil) {
            
            model.supplierName=@"";
        }
        
    NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@\n%@",model.supplierName,model.shopName]];
    
    [AttributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(model.supplierName.length+1,model.shopName.length)];
    
      [AttributedStr addAttribute:NSForegroundColorAttributeName value:TBColorSubTitle range:NSMakeRange(model.supplierName.length+1,model.shopName.length)];
    
    self.Namelabel.attributedText=AttributedStr;
        
    }
    
    if (self.isClick) {
        
        if (model.Select) {
            
            self.editImageView.image=[UIImage imageNamed:@"Select"];
            
        }else{
            
            self.editImageView.image=[UIImage imageNamed:@"UnSelect"];
        }
    }
    
    self.TimeLabel.text=[HelpWay timestampChangesStandarTime:model.orderDate];
    
}

-(void)setNmodel:(CandLData *)Nmodel
{
    _Nmodel=Nmodel;
 
     self.OrderIDLabel.text=Nmodel.orderSn;
    
    self.Namelabel.text=Nmodel.shopName;
    
    self.TimeLabel.text=[HelpWay timestampChangesStandarTime:Nmodel.orderDate];
    
    if (self.isClick) {
        
        if (Nmodel.Select) {
            
            self.editImageView.image=[UIImage imageNamed:@"Select"];
            
        }else{
            
            self.editImageView.image=[UIImage imageNamed:@"UnSelect"];
        }
    }
    
}

-(void)setOutModel:(CandLData *)OutModel
{
    _OutModel=OutModel;
    
    self.OrderIDLabel.text=OutModel.orderSn;
    
    self.Namelabel.text=OutModel.shopName;
    
    self.TimeLabel.text=[HelpWay timestampChangesStandarTime:OutModel.orderDate];
    
    if (self.isClick) {
        
        if (OutModel.Select) {
            
            self.editImageView.image=[UIImage imageNamed:@"Select"];
            
        }else{
            
            self.editImageView.image=[UIImage imageNamed:@"UnSelect"];
        }
    }
 
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
